<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="com.baoku.wap.dao.*"  %>
<%@ page import="com.baoku.wap.entity.*" %>
<%@ include file="session.jsp" %>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="Cache-control" content="no-cache"/>
<style type="text/css">
* { font-size:12px; }
body, div, p, img, form, input { margin:0; padding:0; line-height:22px; font-size:13px;}
a { text-decoration:none; }
a:hover, a:active, a:focus { text-decoration:underline; }
input { vertical-align:middle; line-height:22px; }
.logo{ height:25px;background:#CED7E6}
.login_nav { padding:2px 0 2px 5px; color:#fff; background:#811C40; border-top:1px solid #681432; border-bottom:1px solid #681432; }
.login_nav a { color:#fff; }
.qa_1 { padding:2px 0 2px 5px; background:#DDEBF9; }
.qa_1 .a_q { color:#063456; }
.qa_1 .a_c { color:#0A8B00; }
.answer,.about { background:#EDF4FA; padding:2px 0 2px 5px; border-top:1px dotted #BED8E9; }
.about a{ color:#095A99;}
.inner_url { padding:2px 0 2px 5px; background:#DEECF9; }
.inner_url a { color:#065A98 }
textarea{ width:95%}
.com_title { padding:2px 0 2px 5px; color:#B3E2FE; background:#0E7A96; border-bottom:1px solid #0A5C71; border-top:1px solid #0A5C71; }
.about{ border-bottom:1px solid #C1D7EC;}
.us_footer { background:#EDF5FB; color:#065A97; padding:2px 0 2px 5px; border-bottom:3px solid #0E6AAB; }
.us_footer a { color:#065A97; }
.footer { padding:2px 0 2px 5px; color:#065A97; background:url(images/bg_footer.jpg) repeat-x #E4F1FA; height:30px; }
</style>
<title>欢迎来到宝酷网</title>
<%
  int id = 1 ;
  try{
  	id = Integer.parseInt(request.getParameter("id"));
  	if(id < 1){
  		response.sendRedirect("index.jsp");
  	}
  }catch(Exception e){
  	response.sendRedirect("index.jsp");
  }
  
  Knowledge knowledge = new DateFactory().getInner(id);
  ArrayList list = knowledge.getComList(); //这个页面最多就只有两条评论
%>
</head>
<body>
<div class="logo"><img src="images/logo.gif" alt="宝酷网" width="240" height="25" /></div>
<% if (login == false) {%> 
<div class="login_nav">[<a href="reg.jsp">免费注册</a>][<a href="login.jsp">登录</a>]</div>
<% } else { %>
<div class="login_nav">欢迎您:<%=(String)session.getAttribute("id") %> <br />
[<a href="mylist.jsp">我的收藏夹</a>][<a href="exit.jsp">退出</a>]</div>
<% } %>
<div class="qa_1"><img src="images/icon_list.gif" width="12" height="9" /><a class="a_c"><%=knowledge.getQuestion() %></a></div>
<div class="answer">[答案]<br /><%=knowledge.getAnswer() %>
<div class="inner_url"><a href="#">&gt;查看全文</a><br />
  <a href="favorite.jsp?knowledgeid=<%=id %>">&gt;添加收藏</a><br />
  <a href="index.jsp">&gt;返回首页</a><br />
  <a href="class.jsp">&gt;返回分类页</a></div>
<div class="com_title"><a href="com.jsp?id=<%=id %>">网友评论</a>(<%=knowledge.getAllcom() %>条)</div>
<% if(knowledge.getAllcom() == 0){%>
<div class="qa_1">沙发空缺中还不快抢...</div>
<%}%>
<% if(knowledge.getAllcom() == 1){
	Commont com = (Commont)list.get(0);
%>
<div class="qa_1">[<%=com.getUserid() %>]:<%=com.getCom() %></div>
<%}%>
<% if(knowledge.getAllcom() > 1){
   Commont com1 = (Commont)list.get(0);
   Commont com2 = (Commont)list.get(1);
%>
<div class="qa_1">[<%=com1.getUserid() %>]：<%=com1.getCom() %></div>
<div class="answer">[<%=com2.getUserid() %>]：<%=com2.getCom() %></div>
<%}%>

<form class="answer" action="docom.jsp" >
  <p>我要评论</p>
  <input type="hidden" name="knowledgeid" value="<%=id %>"/>
  <textarea name="content" rows="2" ></textarea>
  <p>
    <input name="" type="image" src="images/btn_g.gif" />
  </p>
</form>
<div class="about"> 相关问题<br />
  <a href="#"> 如何才能在短时间内提高考试</a><br />
  <a href="#"> 如何才能在短时间内提高考试</a> <br />
  <a href="#"> 如何才能在短时间内提高考试</a> </div>
<div class="us_footer"><a href="#">在线帮助</a>&nbsp;<a href="#">关于我们</a></div>
<div class="footer">copyright</div>
</body>
</html>
